<?xml version="1.0" encoding="windows-1252"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>

    </h:head>
    <h:body>

        <ui:composition template="WEB-INF/facelets/Template.xhtml">



            <ui:define name="content">

                <center>
                    <h:form>
                        <h:inputText  id="txtData" value="#{SearchBean.searchQuery}"/> <br/>
                        <h:commandButton id="btnOK" value="Search"
                                         actionListener="#{SearchBean.performSearch}" />
                    </h:form> <div id="ruta">
                        <h:form>
                            <p:panel>

                            <p:dataTable var="torrent" value="#{SearchBean.result}"
                                         paginator="true" rows="10"
                                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         rowsPerPageTemplate="5,10,15,20">
                                <f:facet name="header">
                                </f:facet>

                                <p:column sortBy="#{torrent.name}">
                                    <f:facet name="header">
                                        <h:outputText value="Name" />
                                    </f:facet>
                                    <h:commandLink id="viewDetails" action="#{SearchBean.viewDetails(torrent)}" value="#{torrent.name}"/>
                                </p:column>

                                <p:column sortBy="#{torrent.date}">
                                    <f:facet name="header">
                                        <h:outputText value="Uploaded" />
                                    </f:facet>
                                    <h:outputText value="#{torrent.date}" />
                                </p:column>

                                <p:column sortBy="#{torrent.size}">
                                    <f:facet name="header">
                                        <h:outputText value="Size" />
                                    </f:facet>
                                    <h:outputText value="#{torrent.size}" />
                                </p:column>

                                <p:column sortBy="#{torrent.user.username}">
                                    <f:facet name="header">
                                        <h:outputText value="User" />
                                    </f:facet>
                                    <h:outputText value="#{torrent.user.username}" />
                                </p:column>

                                <p:column rendered="#{UserBean.user.rank == 'ADMIN'}">
                                    <f:facet name="header">
                                      <h:outputText value="Delete" />
                                    </f:facet>
                                    <h:commandLink id="delete" action="#{SearchBean.deleteTorrent(torrent)}">X</h:commandLink>
                                </p:column>
                            </p:dataTable>
                            </p:panel>
                        </h:form>
                    </div>
                </center>
            </ui:define>
        </ui:composition>

    </h:body>
</html>
